﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Problem7
{
    class Program
    {
        static List<long> primes = new List<long>(10002) { 2, 3, 5, 7, 11, 13, 17, 19 };

        static void Main(string[] args)
        {
            long currentNumber = 21;
            while (primes.Count < 10001)
            {
                if (IsPrime(currentNumber))
                {
                    primes.Add(currentNumber);
                }

                currentNumber += 2;
            }

            Console.WriteLine(primes.Last());
            Console.ReadKey();
        }

        private static bool IsPrime(long currentNumber)
        {
            for (int i = 0; i < primes.Count; i++)
            {
                if (currentNumber % primes[i] == 0)
                {
                    return false;
                }
            }

            return true;
        }
    }
}
